package outputstream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class FileOutputStream01 {
    public static void main(String[] args) {
        writeFile();
    }

    public static void writeFile(){
        String filePath = "D:/IO/demo01.txt";
        //创建FileOutputStream对象
        FileOutputStream fileOutputStream = null;
        try {

            fileOutputStream = new FileOutputStream( filePath );
            //fileOutputStream.write('H');
           String str = "Hello my name is yunding";
            fileOutputStream.write(str.getBytes());

        } catch (IOException e) {
          e.printStackTrace();
        }finally {
            try {
                fileOutputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
